﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace DataTier
{
    [KnownType(typeof(Customer))]
    [KnownType(typeof(Battery))]
    [KnownType(typeof(Route))]
    [KnownType(typeof(Subscription))]
    [DataContract(IsReference = true)]
    public class Booking
    {
        //private Customer _customer;
        private Battery _battery;
        private DateTime _bookingDate;
        private int _bookingId;
        private bool _isCollected;
        private bool _isCancelled;
        private Subscription _subscription;
        //private Route _route;
      

        #region Constructors

        public Booking(int bookingId, bool isCollected, bool isCancelled, DateTime bookingDate, Customer customer, Battery battery)
        {
            this._bookingId = bookingId;
            this._isCollected = isCollected;
            this._isCancelled = isCancelled;
            this._bookingDate = bookingDate;
            //this._customer = customer;
            this._battery = battery;
        }

        public Booking(int bookingId, bool isCollected, bool isCancelled)
        {
            this._bookingId = bookingId;
            this._isCollected = isCollected;
            this._isCancelled = isCancelled;
            
       
           
        }

        public Booking(DateTime bookingDate)
        {
            this._bookingDate = bookingDate;
        }

        public Booking(int bookingId, int subId)
        {
            this._bookingId = bookingId;
            _subscription = new Subscription(subId);
        }

        #endregion

        #region Properties

        [DataMember]
        public int BookingId
        {
            get { return _bookingId; }
            set { _bookingId = value; }
        }

        [DataMember]
        public bool IsCollected
        {
            get { return _isCollected; }
            set { _isCollected = value; }
        }

        [DataMember]
        public bool IsCancelled
        {
            get { return _isCancelled; }
            set { _isCancelled = value; }
        }

        [DataMember]
        public DateTime BookingDate
        {
            get { return _bookingDate; }
            set { _bookingDate = value; }
        }

        //[DataMember]
        //public Customer Customer
        //{
        //    get { return _customer; }
        //    set { _customer = value; }
        //}

        [DataMember]
        public Battery Battery
        {
            get { return _battery; }
            set { _battery = value; }
        }

        //[DataMember]
        //public Route Route
        //{
        //    get { return _route; }
        //    set { _route = value; }
        //}

        [DataMember]
        public Subscription Subscription
        {
            get { return _subscription; }
            set { _subscription = value; }
        }

        #endregion
    }
}
